@config.main("RNA-seq") {

    <div class="body-box">
        <div class="page-box">

            @config.subTitle("RNA-seq")

            <div class="main-body">

                @RnaSelect


                    <button class="btn my-btn" style="width: 50px;float: right;margin-bottom: 10px" id="download-rna">
                        <i class="fa fa-download"></i>
                    </button>

                <table class="table table-hover" id="table" data-pagination="true" data-advanced-sortable="true"
                data-page-list="[10]"  >
                </table>


            </div>
        </div>
    </div>


    <script>

        $(function () {
            ChangeRna()
        })

        function ChangeRna() {
            let rnaType = $("#rna-type").val();
            $("#table").bootstrapTable("destroy")
            $.post("/alfalfa/rnaSeq/getHeader?rna="+rnaType,(data)=>{
                let columns = []
                $.each(data,(i,v)=>{
                    if(i === 0){
                        columns.push({
                            field: i,
                            title: v,
                            formatter:function (value,rows) {
                                let vs = value.split('.')
                                let geneid = vs.slice(0,vs.length-1).join(".")
                                return `<a href="/alfalfa/browse/geneByGeneId/${geneid}" target="_blank">${value}</a>`
                            }
                        })
                    }else {
                        columns.push({
                            field: i,
                            title: v
                        })
                    }
                })

                $("#download-rna").attr("onclick",`DownloadRna('${rnaType}')`)
                $("#table").bootstrapTable({
                    method:"post",
                    url:"/alfalfa/rnaSeq/getData?rna=" + rnaType,
                    sidePagination: "server",
                    contentType: "application/x-www-form-urlencoded",
                    columns:columns
                })

            })

        }

        function DownloadRna(rnaType) {
            window.location.href="/alfalfa/download/downloadRNAseq?rnaType=" + rnaType;
        }



    </script>
}


@RnaSelect = {
    <select class="form-control" id="rna-type" onchange="ChangeRna()" style="margin-bottom: 15px">
        <option value="1">1. Roots under Al treatment</option>
        <option value="2">2. Leaves under cow saliva treatment</option>
        <option value="3">3. Roots under ABA treatment</option>
        <option value="4">4. Roots under salt & mannitol treatment</option>
        <option value="5">5. Seedlings under cold treatment</option>
        <option value="6">6. Leaves at different stages</option>
        <option value="7">7. Different tissues of Medicago sativa</option>
        <option value="8">8. Roots infected with root-knot nematode</option>
        <option value="9">9. 27 diverse alfalfa genotypes</option>
        <option value="10">10. Buds under salt stress</option>
        <option value="11">11. Roots at seedling stage under Cd stress</option>
        <option value="12">12. Roots at germination stage under salt stress</option>
        <option value="13">13. Roots at seedling stage under salt stress</option>
        <option value="14">14. Different defoliation traits (leaf)</option>
        <option value="15">15. Divergent cell wall composition</option>
        <option value="16">16 .Roots under atrazine treatment</option>
        <option value="17">17. Roots under Pb treatment</option>
        <option value="18">18. Leaves with different dormancy</option>
    </select>

}